<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>编辑新闻信息</title>
<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
	<script type="text/javascript">
        function getCtxPath() {
            return "${ctxPath}";
        }
	</script>
	<script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
	<script type="text/javascript" charset="utf-8" src="${base}/resources/admin/neditor/neditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="${base}/resources/admin/neditor/neditor.all.min.js"> </script>
	<script type="text/javascript" charset="utf-8" src="${base}/resources/admin/neditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript">

        var _upeditor;
        $().ready(function() {

            var $inputForm = $("#inputForm");

            [@flash_message /]
            var ue = UE.getEditor('editor');
            ue.ready(function(){
                ue.setContent('${news.content}');
			});

            _upeditor = UE.getEditor('upload_ue');
            _upeditor.ready(function(){
                _upeditor.hide();
                _upeditor.addListener('beforeInsertImage',function(t,arg){
                    $('#icon_url').val(arg[0].src);
                });
            });

            // 表单验证
            $inputForm.validate({
                rules: {
                    "news.title": "required",
                    "news.content": "required",
                    "news.status" : "required",
                    "news.icon_url": "required",
                    "news.orders": "digits"
                }
            });

        });

        function browserImg() {
            _upeditor.getDialog("insertimage").open();
        }

	</script>
	<style type="text/css">
		table.input td {
			line-height: 15px;
			padding: 5px;
			color: #666666;
			border-bottom: 1px solid #dde9f5;
		}
	</style>

</head>
<body>
	<div class="path">
		<a href="${base}/admin/common/index">${message("admin.path.index")}</a> &raquo; 编辑新闻信息
	</div>
	<form id="inputForm" action="update" method="post">
		<input type="hidden" name="news.id" value="${news.id}"/>
		<table class="input">
			<tr>
				<th>
					<span class="requiredField">*</span>标题:
				</th>
				<td>
					<input type="text" name="news.title" class="text" value="${news.title}" maxlength="200" />
				</td>
			</tr>
			<tr>
				<th>
					副标题:
				</th>
				<td>
					<input type="text" name="news.sub_title" class="text" value="${news.sub_title}" maxlength="200" />
				</td>
			</tr>
			<tr>
				<th>
					<span class="requiredField">*</span>是否在新闻资讯显示:
				</th>
				<td>
					<select name="news.status">
						<option value="OFFLINE" [#if news.status == 'OFFLINE'] selected = "selected" [/#if] >不显示</option>
						<option value="ONLINE" [#if news.status == 'ONLINE'] selected = "selected" [/#if]>显示</option>
					</select>
				</td>
			</tr>
			<tr>
				<th>
					排序:
				</th>
				<td>
					<input type="text" name="news.orders" class="text" title="按数字从大到小排序" maxlength="9"  value="${news.orders}"/>
                    <span class="tips">"按数字从大到小排序"</span>
				</td>
			</tr>
			<tr>
				<th>
					<span class="requiredField">*</span>图标:
				</th>
				<td>
					<script type="text/plain" id="upload_ue"></script>
					<input id ="icon_url" type="text" name="news.icon_url" value="${news.icon_url}" readonly = "true" class="text" maxlength="200" />
					<input id="btn_browser" type="button" class="button" value="选择图片" onclick="browserImg()" />
				</td>
			</tr>
			<tr>
				<th>
					<span class="requiredField">*</span>内容:
				</th>
				<td>
					<script id="editor" type="text/plain" name="news.content"  style="width:100%;height:300px;"></script>
				</td>
			</tr>
			<tr>
				<th>
					&nbsp;
				</th>
				<td>
					<input type="submit" class="button" value="${message("admin.common.submit")}" />
					<input type="button" id="backButton" class="button" value="${message("admin.common.back")}" />
				</td>
			</tr>
		</table>
	</form>
</body>
</html>